construction

[1,2,3]
#  [1, 2, 3]
list((1,2,3)) # casting
#  [1, 2, 3]

assertions

mylist = ['a', 'b', 'c']
'b' in mylist
#  True

indexing

x[start:stop:step]

If any of these are unspecified, they default to start=0, stop=len(x), step=1.

mylist = [1,2,3,4,5,6,7,8,9,10]
mylist[0]
#  1
mylist[5]
#  6
mylist[-1]
#  10
mylist[-5]
#  6
mylist[3:5]
#  [4, 5]
mylist[:5]
#  [1, 2, 3, 4, 5]
mylist[5:]
#  [6, 7, 8, 9, 10]
mylist[:-5]
#  [1, 2, 3, 4, 5]

methods

append

mylist = ['a', 'b', 'c']
mylist.append('d')
mylist
#  ['a', 'b', 'c', 'd']

sort

sort elements

mylist = ['c', 'b', 'a']
mylist.sort()
mylist
#  ['a', 'b', 'c']

sort using a function of the elements

mylist = [[3,2,1], [2,1,3], [1,2,2]]
mylist.sort(key = lambda x: x[2])
mylist
#  [[3, 2, 1], [1, 2, 2], [2, 1, 3]]